namespace JQuery.WebKit
{
    using System;
    using System.Security.Permissions;
    using System.Web;

    [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
    public class WebGridColumnFormatterCollection : BaseItemCollection<WebGridColumn, WebGridColumnFormatter>
    {
        private static readonly Type[] _knownTypes = new Type[] { typeof(IntegerFormatter), typeof(LinkFormatter), typeof(EmailFormatter), typeof(CheckBoxFormatter), typeof(CurrencyFormatter), typeof(NumberFormatter), typeof(CustomFormatter) };

        public WebGridColumnFormatterCollection()
        {

        }

        protected override object CreateKnownType(int index)
        {
            switch (index)
            {
                case 0:
                    return new IntegerFormatter();

                case 1:
                    return new LinkFormatter();

                case 2:
                    return new EmailFormatter();

                case 3:
                    return new CheckBoxFormatter();

                case 4:
                    return new CurrencyFormatter();

                case 5:
                    return new NumberFormatter();

                case 6:
                    return new CustomFormatter();
            }
            throw new ArgumentOutOfRangeException("index");
        }

        protected override Type[] GetKnownTypes()
        {
            return _knownTypes;
        }
    }
}

